<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>promise封装ajax</title>
</head>
<body>
<script>
    const  p = new Promise((resolve,reject) => {
        setTimeout(() => {
            reject('用户数据');
        },1000)
    });

    //调用then方法
    //如果回调函数中返回的结果是非promise类型属性
    p.then(value => {
        console.log(value);
    },reason => {
        console.warn(reason);
    })
</script>

</body>
</html>